<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<div class="am-modal am-modal-no-btn" tabindex="-1" id="personListModel">
	<div class="am-modal-dialog">
		<div class="am-modal-hd">
			选择人员 <a href="javascript: void(0)" class="am-close am-close-spin"
				data-am-modal-close>&times;</a>
		</div>
		<div class="am-modal-bd">
			<div class="am-g">
				<div class="am-u-sm-12">
					<table id="personTable" class="am-table am-table-bordered am-table-centered">
						<thead>
							<tr>
								<th class="table-check"></th>
								<th class="table-title">用户名</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${page.rows }" var="model">
								<tr>
									<td><input type="checkbox" value="${model.fdId }" /></td>
									<td><a href="#" name="fdName">${model.fdName }</a></td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
					<div class="am-margin">
						<button type="button" onclick="getPerson()"
							class="am-btn am-btn-primary am-btn-xs">确定</button>
					</div>
					<div class="am-cf">
						共 ${page.totalSize} 条记录
						<div class="am-fr">
							<ul class="am-pagination">

							</ul>
						</div>
					</div>
					<hr />
				</div>

			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	$(document).ready(function() {
		//初始化页数
		pagination("${page.totalPage}", "${page.pageNo}");
	});
	
	function getPerson(){
		var fdIds = "";
		var fdNames = "";
		$("#personTable").find("input[type='checkbox']:checked").each(function(){
			fdIds += $(this).val()+";";
			var fdName = $(this).parent().next().find("a").text();
			fdNames += fdName+";";
		});
		if(fdIds!=""){
			fdIds = fdIds.substring(0,fdIds.length-1);
		}
		$("#fdOrgElementsId").val(fdIds);
		$("#fdOrgElementsName").text(fdNames);
		var $modal = $('#personListModel');
		$modal.modal('close');
	}
</script>